
ifeq ($(strip $(BIN)),)
$(error " BIN is not define !")
endif

BIN_FILE := $(subst \,/,$(BIN))

TCL := write.tcl

write_bin := $(write.bin)

all:write_flash

$(write_bin):$(BIN)
	lua bin2tcl.lua $(BIN_FILE) $(@) >$(TCL)

write_flash:$(write_bin)
	openocd -f link.cfg -f hpm5300.cfg -f hpm5300_write.cfg


